//
//  SecondViewController.m
//  豆瓣CollectionView
//
//  Created by kingbw on 16/1/29.
//  Copyright © 2016年 kingbw. All rights reserved.
//

#import "SecondViewController.h"
#import "UIImageView+WebCache.h"
#import "MovieDetailModel.h"
@interface SecondViewController ()

@property (nonatomic, strong) UIImageView *imgView;
@property (nonatomic, strong) UILabel *label;
@property (nonatomic, strong) MovieDetailModel *movieDetailModel;


@end

@implementation SecondViewController

- (instancetype)initwithMovieDetailModel:(MovieDetailModel *)model {
    
    if (self) {
        self.movieDetailModel = model;
    }
    
    return self;
}




- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.view.backgroundColor = [UIColor whiteColor];
    
    self.imgView = [[UIImageView alloc] initWithFrame:CGRectMake((self.view.frame.size.width - 200) / 2, 100, 200, 300)];
    [self.view addSubview:self.imgView];
    
    self.label = [[UILabel alloc] initWithFrame:CGRectMake((self.view.frame.size.width - 200) / 2, 430, 200, 40)];
    self.label.textAlignment = NSTextAlignmentCenter;
    [self.view addSubview:self.label];
    
    [self.imgView sd_setImageWithURL:[NSURL URLWithString:self.movieDetailModel.imageModel.large]];
    self.label.text = self.movieDetailModel.title;
    
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
